﻿using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class GenWaterFMine : MonoBehaviour {

    public GameObject waterFPfb;
    public Transform genPoint;
    public Transform woodPoint;
    private bool hasGen = false;

    void OnTriggerEnter2D(Collider2D coll)
    {
        //Debug.Log("GenWaterF -> OnCollisionEnter2D");
        if (coll.transform.tag == "Player")
        {
            //Debug.Log("GenWaterF -> OnCollisionEnter2D");

            if (!hasGen)
            {   
                GameObject gobj = Instantiate(waterFPfb);
                gobj.transform.position = genPoint.position;
                gobj.GetComponent<WaterFFloatCtrl>().downDetal = woodPoint.position.y - genPoint.position.y;
                gobj.transform.SetParent(transform);
                hasGen = true;
            }
        }
    }
}
